/******************
Online Appendix H
*******************/

clear
cd "C:\Users\jar68\OneDrive\Ongoing Work\Party Cues and Suspicion Paper\Final Datavserse\Data"
use "exp3_cleaned.dta"
cd "C:\Users\jar68\OneDrive\Ongoing Work\Party Cues and Suspicion Paper\Final Datavserse\Online Appendix H"
log using "appendix_oh_log.log"
set more off

foreach var in inferences prox {
	summ `var' 
	gen `var'01 = (`var' - r(min))/(r(max)-r(min))
}

encode treat_3, gen(tr1)
encode change_stereotype, gen(tr2)
encode pid_2, gen(pid_2a)


/******************
Table OH1: OLS Model
*******************/

eststo clear
eststo: regress inferences01 i.tr1##i.pid_2a i.tr2
eststo: regress prox01 i.tr1##i.pid_2a i.tr2

esttab using "table_oh1.rtf", replace ///
onecell label nobaselevels b(2) se star(* 0.05 ** 0.01 *** 0.001) ///
	mtitles("Inferences" "Proximity") ///
	title("{\b Table OH1:} PID Interaction MOdels, Proximity and Inferences, Experiment 3") 
	
	
/******************
Table OH2: Marginal Effects
Note: The differences portion of the table was added manuallly (see lincom results) and some
rearranging was also done
*******************/
regress inferences01 i.tr1##i.pid_2a i.tr2
	margins, dydx(tr1) by(pid_2a) post coeflegend
	estimates store m1
	*Democrats
	lincom  _b[2.tr1:1bn.pid_2a] - _b[3.tr1:1bn.pid_2a]
	*Republicans 
	lincom _b[2.tr1:2.pid_2a] -  _b[3.tr1:2.pid_2a]
	
regress prox01 i.tr1##i.pid_2a i.tr2
	margins, dydx(tr1) by(pid_2a) post coeflegend
	estimates store m2
	*Democrats
	lincom  _b[2.tr1:1bn.pid_2a] - _b[3.tr1:1bn.pid_2a]
	*Republicans 
	lincom _b[2.tr1:2.pid_2a] -  _b[3.tr1:2.pid_2a]

esttab m1 m2  using "table_oh2_margins.rtf", replace ///
	onecell label nobaselevels b(2) ci ///
	mtitles("Inferences" "Prox") ///
	title("{\b Table OH2:} Marginal Effects From Table OH1")
	
	
log close
